﻿Imports Cls_Common
Imports VSModel
Imports System.IO
Partial Class Control_Contents_ListUpdate
    Inherits System.Web.UI.UserControl

    Protected Sub btnClick_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClick.Click

        Dim str As New StringBuilder

        Using _data As New VSEntities
            'add DomainName Duc 08/09/2014
            Dim p = (From q In _data.formulae Where q.Domain = DomainName Order By q.Id Select q).ToList
            Dim i = 0
            For Each a In p
                'check exist file
                Dim _Root As String = "E:\ssm\"
                If Not a.Image Is Nothing Then
                    Dim _file As String = a.Image.Replace("http://image.sucsongmoi.net/", "")
                    Dim check As Boolean = File.Exists(_Root & _file)
                    If Not check Then
                        str.Append(a.Id & ", ")
                        i = i + 1
                    End If
                End If

            Next
            str.Append("@@" & i.ToString)
            Dim objWriter As New System.IO.StreamWriter("E:\ssm\Fomular.txt")

            objWriter.Write(str)
            objWriter.Close()

        End Using


    End Sub

End Class
